package com.cloudm.technician.ui.modules.cloudm_box.install_check

import com.cloudm.technician.data.model.DeviceInfo
import com.cloudm.technician.extensions.isSnCode
import com.cloudm.technician.ui.base.RxPresenter

/**
 * 作者: wesley
 * 时间: 2017/12/25
 * 描述: 业务逻辑
 */
class InstallCheckPresenter(private val view: InstallCheckContract.View) : RxPresenter(),
        InstallCheckContract.Presenter {



    override fun dealWithScanResult(value: String?, info: DeviceInfo?) {

        if (value == null || value.isNullOrEmpty()) {
            view.showSnEmpMsg()
            return
        }

        if (!value.isSnCode()) {
            view.showSnFormatErrMsg()
            return
        }

        if (info == null) {
            view.showDeviceInfoEmpMsg()
            return
        }
        view.scanSuccess(info, value)

    }
}